﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <!--During development turn off caching-->
    <meta http-equiv="cache-control" content="max-age=0" />
    <meta http-equiv="cache-control" content="no-cache" />
    <meta http-equiv="expires" content="0" />
    <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
    <meta http-equiv="pragma" content="no-cache" />

    <title></title>
    <!-- Office UI Fabric for look and feel. Visit http://dev.office.com/fabric for more info-->
    <link rel="stylesheet" href="https://appsforoffice.microsoft.com/fabric/1.0/fabric.min.css">
    <link rel="stylesheet" href="https://appsforoffice.microsoft.com/fabric/1.0/fabric.components.min.css">

    <!--JQuery-->
    <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>

    <!--Office.js-->
    <script src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js" type="text/javascript"></script>
    <script>
        // The initialize function must be run each time a new page is loaded
        (function () {
        Office.initialize = function (reason) {
            $(document).ready(function () {
                $("#writeTextButton").click(function (event) {
                    writeText();
                });
                //
            });
        };

        // Reads data from current document selection and displays a notification
        function writeText() {
            Office.context.document.setSelectedDataAsync("More data",
                function (asyncResult) {
                    var error = asyncResult.error;
                    if (asyncResult.status === "failed") {
                        //show error. Upcoming displayDialog API will help here.
                    }
                    else {
                        //show success.Upcoming displayDialog API will help here.
                    }
                });
        }

        })();


    </script>
</head>
<body>
    This is taskpane 2
    <button class="ms-Button" id="writeTextButton">
        <span class="ms-Button-icon"><i class="ms-Icon ms-Icon--plus"></i></span>
        <span class="ms-Button-label">Insert More Text</span>
        <span class="ms-Button-description">Insert Text into Document</span>
    </button>
</body>
</html>
